package cn.tedu.lucky.draw.server.service.Impl;

import cn.tedu.lucky.draw.server.common.enums.ErrorEnum;
import cn.tedu.lucky.draw.server.common.handler.DrawException;

import cn.tedu.lucky.draw.server.protrocol.po.ActivityPrize;
import cn.tedu.lucky.draw.server.repository.ActivityPrizeRepository;
import cn.tedu.lucky.draw.server.service.IActivityPrizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ActivityPrizeServiceImpl implements IActivityPrizeService {

    @Autowired
    private ActivityPrizeRepository activityPrizeRepository;

    @Override
    public void saveAll(List<ActivityPrize> activityPrizeList) {
        List<ActivityPrize> activityPrizes = activityPrizeRepository.saveAll(activityPrizeList);
        if (activityPrizes==null){
            throw new DrawException(ErrorEnum.SYSTEM_ERROR);
        }
    }
}
